package gt;

import java.util.ArrayList;
import java.util.List;

public class Main {
	private static int len = 0;
	static List<String> permList = new ArrayList<String>();

	public static void main(String[] args) {
		String input = "abcd";
		int noOfChars = 3;
		calcCombination(input.toCharArray(), noOfChars);
	}

	// combination ab=ba, so less

	public static List<String>  calcCombination(char[] input, int noOfChars) {
		// loop for n-r
		for (int i = 0; i < input.length - noOfChars + 1; i++) {
			char[] chars = new char[noOfChars];
			// current first character
			chars[0] = input[i];
			for (int j = i; j < input.length - noOfChars+1 ; j++) {
				// take other noOfChars
				for (int k = 1; k < noOfChars; k++) {
					chars[k] = input[j + k];
				}
				String comb = new String(chars);
				System.out.println(comb);
			}
		}
		return null;
	}

}
